
#include "buffer.hpp"


//----------------------------------------------------------------------//
//----------------------------------------------------------------------//
//----------------------------------------------------------------------//

static CRC_Calculator_ct crc8 {CRC_ALGO_CRC8};
static CRC_Calculator_ct crc16 {CRC_ALGO_CRC16_A};
static CRC_Calculator_ct crc32 {CRC_ALGO_CRC32};
static CRC_Calculator_ct crc64 {CRC_ALGO_CRC64_ISO};

static AccuSum_Calculator_ct<std::uint8_t>  acc8;
static AccuSum_Calculator_ct<std::uint16_t> acc16;
static AccuSum_Calculator_ct<std::uint32_t> acc32;
static AccuSum_Calculator_ct<std::uint64_t> acc64;

static std::uint8_t array_fixed_u8_crc[]  = {0xEB, 0x90, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x85};
static std::uint8_t array_fixed_u16_crc[] = {0xEB, 0x90, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x60, 0x02};
static std::uint8_t array_fixed_u32_crc[] = {0xEB, 0x90, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x46, 0xD7, 0x6C, 0x45};
static std::uint8_t array_fixed_u64_crc[] = {0xEB, 0x90, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x2C, 0x3D, 0x89, 0x58, 0xEA, 0x28, 0x87, 0xA8};
static std::uint8_t array_fixed_u8_sum[]  = {0xEB, 0x90, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x2D};
static std::uint8_t array_fixed_u16_sum[] = {0xEB, 0x90, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x2D, 0x00};
static std::uint8_t array_fixed_u32_sum[] = {0xEB, 0x90, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x2D, 0x00, 0x00, 0x00};
static std::uint8_t array_fixed_u64_sum[] = {0xEB, 0x90, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x2D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};

static std::uint8_t array_unfix_u8_crc[]  = {0xEB, 0x90, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x85, 0xEB, 0x01};
static std::uint8_t array_unfix_u16_crc[] = {0xEB, 0x90, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x60, 0x02, 0xEB, 0x01};
static std::uint8_t array_unfix_u32_crc[] = {0xEB, 0x90, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x46, 0xD7, 0x6C, 0x45, 0xEB, 0x01};
static std::uint8_t array_unfix_u64_crc[] = {0xEB, 0x90, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x2C, 0x3D, 0x89, 0x58, 0xEA, 0x28, 0x87, 0xA8, 0xEB, 0x01};
static std::uint8_t array_unfix_u8_sum[]  = {0xEB, 0x90, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x2D, 0xEB, 0x01};
static std::uint8_t array_unfix_u16_sum[] = {0xEB, 0x90, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x2D, 0x00, 0xEB, 0x01};
static std::uint8_t array_unfix_u32_sum[] = {0xEB, 0x90, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x2D, 0x00, 0x00, 0x00, 0xEB, 0x01};
static std::uint8_t array_unfix_u64_sum[] = {0xEB, 0x90, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x2D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xEB, 0x01};

static Frame_Config_st fix_u8_crc {
        ._m_header = Frame_Config_st::Section_st {
                ._section_data  = {0xEB, 0x90},
                ._section_size  = 2,
                ._section_count = 1,
        },
        ._m_tail = Frame_Config_st::Section_st {
                ._section_data  = {0x85},
                ._section_size  = 1,
                ._section_count = 1,
        },
        ._m_check = Frame_Config_st::Check_st {
                ._type               = Frame_Config_st::Check_st::Type_et::Check_Crc,
                ._calculate_instance = &crc8,
                ._offset             = 2,
                ._size_data          = 10,
                ._size_result        = 1,
                ._size_other         = 0,
                ._record_size_offset = 0,
                ._record_size_length = 0,
        },
        ._m_frame_length    = 13,
        ._m_fram_byte_order = Bytes_Calculator_st::ByteOrder_et::Little_Endian,
        ._m_frame_fix       = Frame_Config_st::Fix_et::Fixed,
        ._m_return          = Frame_Config_st::Return_et::After_One,
};

static Frame_Config_st fix_u16_crc {
        ._m_header = Frame_Config_st::Section_st {
                ._section_data  = {0xEB, 0x90},
                ._section_size  = 2,
                ._section_count = 1,
        },
        ._m_tail = Frame_Config_st::Section_st {
                ._section_data  = {0x60, 0x02},
                ._section_size  = 2,
                ._section_count = 1,
        },
        ._m_check = Frame_Config_st::Check_st {
                ._type               = Frame_Config_st::Check_st::Type_et::Check_Crc,
                ._calculate_instance = &crc16,
                ._offset             = 2,
                ._size_data          = 10,
                ._size_result        = 2,
                ._size_other         = 0,
                ._record_size_offset = 0,
                ._record_size_length = 0,
        },
        ._m_frame_length    = 14,
        ._m_fram_byte_order = Bytes_Calculator_st::ByteOrder_et::Little_Endian,
        ._m_frame_fix       = Frame_Config_st::Fix_et::Fixed,
        ._m_return          = Frame_Config_st::Return_et::After_One,
};

static Frame_Config_st fix_u32_crc {
        ._m_header = Frame_Config_st::Section_st {
                ._section_data  = {0xEB, 0x90},
                ._section_size  = 2,
                ._section_count = 1,
        },
        ._m_tail = Frame_Config_st::Section_st {
                ._section_data  = {0x46, 0xD7, 0x6C, 0x45},
                ._section_size  = 4,
                ._section_count = 1,
        },
        ._m_check = Frame_Config_st::Check_st {
                ._type               = Frame_Config_st::Check_st::Type_et::Check_Crc,
                ._calculate_instance = &crc32,
                ._offset             = 2,
                ._size_data          = 10,
                ._size_result        = 4,
                ._size_other         = 0,
                ._record_size_offset = 0,
                ._record_size_length = 0,
        },
        ._m_frame_length    = 16,
        ._m_fram_byte_order = Bytes_Calculator_st::ByteOrder_et::Little_Endian,
        ._m_frame_fix       = Frame_Config_st::Fix_et::Fixed,
        ._m_return          = Frame_Config_st::Return_et::After_One,
};

static Frame_Config_st fix_u64_crc {
        ._m_header = Frame_Config_st::Section_st {
                ._section_data  = {0xEB, 0x90},
                ._section_size  = 2,
                ._section_count = 1,
        },
        ._m_tail = Frame_Config_st::Section_st {
                ._section_data  = {0x2C, 0x3D, 0x89, 0x58, 0xEA, 0x28, 0x87, 0xA8},
                ._section_size  = 8,
                ._section_count = 1,
        },
        ._m_check = Frame_Config_st::Check_st {
                ._type               = Frame_Config_st::Check_st::Type_et::Check_Crc,
                ._calculate_instance = &crc64,
                ._offset             = 2,
                ._size_data          = 10,
                ._size_result        = 8,
                ._size_other         = 0,
                ._record_size_offset = 0,
                ._record_size_length = 0,
        },
        ._m_frame_length    = 20,
        ._m_fram_byte_order = Bytes_Calculator_st::ByteOrder_et::Little_Endian,
        ._m_frame_fix       = Frame_Config_st::Fix_et::Fixed,
        ._m_return          = Frame_Config_st::Return_et::After_One,
};

static Frame_Config_st fix_u8_sum {
        ._m_header = Frame_Config_st::Section_st {
                ._section_data  = {0xEB, 0x90},
                ._section_size  = 2,
                ._section_count = 1,
        },
        ._m_tail = Frame_Config_st::Section_st {
                ._section_data  = {0x2D},
                ._section_size  = 1,
                ._section_count = 1,
        },
        ._m_check = Frame_Config_st::Check_st {
                ._type               = Frame_Config_st::Check_st::Type_et::Check_Acc,
                ._calculate_instance = &acc8,
                ._offset             = 2,
                ._size_data          = 10,
                ._size_result        = 1,
                ._size_other         = 0,
                ._record_size_offset = 0,
                ._record_size_length = 0,
        },
        ._m_frame_length    = 13,
        ._m_fram_byte_order = Bytes_Calculator_st::ByteOrder_et::Little_Endian,
        ._m_frame_fix       = Frame_Config_st::Fix_et::Fixed,
        ._m_return          = Frame_Config_st::Return_et::After_One,
};

static Frame_Config_st fix_u16_sum {
        ._m_header = Frame_Config_st::Section_st {
                ._section_data  = {0xEB, 0x90},
                ._section_size  = 2,
                ._section_count = 1,
        },
        ._m_tail = Frame_Config_st::Section_st {
                ._section_data  = {0x2D, 0x00},
                ._section_size  = 2,
                ._section_count = 1,
        },
        ._m_check = Frame_Config_st::Check_st {
                ._type               = Frame_Config_st::Check_st::Type_et::Check_Acc,
                ._calculate_instance = &acc16,
                ._offset             = 2,
                ._size_data          = 10,
                ._size_result        = 2,
                ._size_other         = 0,
                ._record_size_offset = 0,
                ._record_size_length = 0,
        },
        ._m_frame_length    = 14,
        ._m_fram_byte_order = Bytes_Calculator_st::ByteOrder_et::Little_Endian,
        ._m_frame_fix       = Frame_Config_st::Fix_et::Fixed,
        ._m_return          = Frame_Config_st::Return_et::After_One,
};

static Frame_Config_st fix_u32_sum {
        ._m_header = Frame_Config_st::Section_st {
                ._section_data  = {0xEB, 0x90},
                ._section_size  = 2,
                ._section_count = 1,
        },
        ._m_tail = Frame_Config_st::Section_st {
                ._section_data  = {0x2D, 0x00, 0x00, 0x00},
                ._section_size  = 4,
                ._section_count = 1,
        },
        ._m_check = Frame_Config_st::Check_st {
                ._type               = Frame_Config_st::Check_st::Type_et::Check_Acc,
                ._calculate_instance = &acc32,
                ._offset             = 2,
                ._size_data          = 10,
                ._size_result        = 4,
                ._size_other         = 0,
                ._record_size_offset = 0,
                ._record_size_length = 0,
        },
        ._m_frame_length    = 16,
        ._m_fram_byte_order = Bytes_Calculator_st::ByteOrder_et::Little_Endian,
        ._m_frame_fix       = Frame_Config_st::Fix_et::Fixed,
        ._m_return          = Frame_Config_st::Return_et::After_One,
};

static Frame_Config_st fix_u64_sum {
        ._m_header = Frame_Config_st::Section_st {
                ._section_data  = {0xEB, 0x90},
                ._section_size  = 2,
                ._section_count = 1,
        },
        ._m_tail = Frame_Config_st::Section_st {
                ._section_data  = {0x2D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
                ._section_size  = 8,
                ._section_count = 1,
        },
        ._m_check = Frame_Config_st::Check_st {
                ._type               = Frame_Config_st::Check_st::Type_et::Check_Acc,
                ._calculate_instance = &acc64,
                ._offset             = 2,
                ._size_data          = 10,
                ._size_result        = 8,
                ._size_other         = 0,
                ._record_size_offset = 0,
                ._record_size_length = 0,
        },
        ._m_frame_length    = 20,
        ._m_fram_byte_order = Bytes_Calculator_st::ByteOrder_et::Little_Endian,
        ._m_frame_fix       = Frame_Config_st::Fix_et::Fixed,
        ._m_return          = Frame_Config_st::Return_et::After_One,
};

static Frame_Config_st unfix_u8_crc {
        ._m_header = Frame_Config_st::Section_st {
                ._section_data  = {0xEB, 0x90},
                ._section_size  = 2,
                ._section_count = 1,
        },
        ._m_tail = Frame_Config_st::Section_st {
                ._section_data  = {0xEB, 0x01},
                ._section_size  = 2,
                ._section_count = 1,
        },
        ._m_check = Frame_Config_st::Check_st {
                ._type               = Frame_Config_st::Check_st::Type_et::Check_Crc,
                ._calculate_instance = &crc8,
                ._offset             = 2,
                ._size_data          = 10,
                ._size_result        = 1,
                ._size_other         = 5,
                ._record_size_offset = 0,
                ._record_size_length = 0,
        },
        ._m_frame_length    = 15,
        ._m_fram_byte_order = Bytes_Calculator_st::ByteOrder_et::Little_Endian,
        ._m_frame_fix       = Frame_Config_st::Fix_et::UnFixed,
        ._m_return          = Frame_Config_st::Return_et::After_One,
};

static Frame_Config_st unfix_u16_crc {
        ._m_header = Frame_Config_st::Section_st {
                ._section_data  = {0xEB, 0x90},
                ._section_size  = 2,
                ._section_count = 1,
        },
        ._m_tail = Frame_Config_st::Section_st {
                ._section_data  = {0xEB, 0x01},
                ._section_size  = 2,
                ._section_count = 1,
        },
        ._m_check = Frame_Config_st::Check_st {
                ._type               = Frame_Config_st::Check_st::Type_et::Check_Crc,
                ._calculate_instance = &crc16,
                ._offset             = 2,
                ._size_data          = 10,
                ._size_result        = 2,
                ._size_other         = 6,
                ._record_size_offset = 0,
                ._record_size_length = 0,
        },
        ._m_frame_length    = 16,
        ._m_fram_byte_order = Bytes_Calculator_st::ByteOrder_et::Little_Endian,
        ._m_frame_fix       = Frame_Config_st::Fix_et::UnFixed,
        ._m_return          = Frame_Config_st::Return_et::After_One,
};

static Frame_Config_st unfix_u32_crc {
        ._m_header = Frame_Config_st::Section_st {
                ._section_data  = {0xEB, 0x90},
                ._section_size  = 2,
                ._section_count = 1,
        },
        ._m_tail = Frame_Config_st::Section_st {
                ._section_data  = {0xEB, 0x01},
                ._section_size  = 2,
                ._section_count = 1,
        },
        ._m_check = Frame_Config_st::Check_st {
                ._type               = Frame_Config_st::Check_st::Type_et::Check_Crc,
                ._calculate_instance = &crc32,
                ._offset             = 2,
                ._size_data          = 10,
                ._size_result        = 4,
                ._size_other         = 8,
                ._record_size_offset = 0,
                ._record_size_length = 0,
        },
        ._m_frame_length    = 18,
        ._m_fram_byte_order = Bytes_Calculator_st::ByteOrder_et::Little_Endian,
        ._m_frame_fix       = Frame_Config_st::Fix_et::UnFixed,
        ._m_return          = Frame_Config_st::Return_et::After_One,
};

static Frame_Config_st unfix_u64_crc {
        ._m_header = Frame_Config_st::Section_st {
                ._section_data  = {0xEB, 0x90},
                ._section_size  = 2,
                ._section_count = 1,
        },
        ._m_tail = Frame_Config_st::Section_st {
                ._section_data  = {0xEB, 0x01},
                ._section_size  = 2,
                ._section_count = 1,
        },
        ._m_check = Frame_Config_st::Check_st {
                ._type               = Frame_Config_st::Check_st::Type_et::Check_Crc,
                ._calculate_instance = &crc64,
                ._offset             = 2,
                ._size_data          = 10,
                ._size_result        = 8,
                ._size_other         = 12,
                ._record_size_offset = 0,
                ._record_size_length = 0,
        },
        ._m_frame_length    = 22,
        ._m_fram_byte_order = Bytes_Calculator_st::ByteOrder_et::Little_Endian,
        ._m_frame_fix       = Frame_Config_st::Fix_et::UnFixed,
        ._m_return          = Frame_Config_st::Return_et::After_One,
};

static Frame_Config_st unfix_u8_sum {
        ._m_header = Frame_Config_st::Section_st {
                ._section_data  = {0xEB, 0x90},
                ._section_size  = 2,
                ._section_count = 1,
        },
        ._m_tail = Frame_Config_st::Section_st {
                ._section_data  = {0xEB, 0x01},
                ._section_size  = 2,
                ._section_count = 1,
        },
        ._m_check = Frame_Config_st::Check_st {
                ._type               = Frame_Config_st::Check_st::Type_et::Check_Acc,
                ._calculate_instance = &acc8,
                ._offset             = 2,
                ._size_data          = 10,
                ._size_result        = 1,
                ._size_other         = 5,
                ._record_size_offset = 0,
                ._record_size_length = 0,
        },
        ._m_frame_length    = 15,
        ._m_fram_byte_order = Bytes_Calculator_st::ByteOrder_et::Little_Endian,
        ._m_frame_fix       = Frame_Config_st::Fix_et::UnFixed,
        ._m_return          = Frame_Config_st::Return_et::After_One,
};

static Frame_Config_st unfix_u16_sum {
        ._m_header = Frame_Config_st::Section_st {
                ._section_data  = {0xEB, 0x90},
                ._section_size  = 2,
                ._section_count = 1,
        },
        ._m_tail = Frame_Config_st::Section_st {
                ._section_data  = {0xEB, 0x01},
                ._section_size  = 2,
                ._section_count = 1,
        },
        ._m_check = Frame_Config_st::Check_st {
                ._type               = Frame_Config_st::Check_st::Type_et::Check_Acc,
                ._calculate_instance = &acc16,
                ._offset             = 2,
                ._size_data          = 10,
                ._size_result        = 2,
                ._size_other         = 6,
                ._record_size_offset = 0,
                ._record_size_length = 0,
        },
        ._m_frame_length    = 16,
        ._m_fram_byte_order = Bytes_Calculator_st::ByteOrder_et::Little_Endian,
        ._m_frame_fix       = Frame_Config_st::Fix_et::UnFixed,
        ._m_return          = Frame_Config_st::Return_et::After_One,
};

static Frame_Config_st unfix_u32_sum {
        ._m_header = Frame_Config_st::Section_st {
                ._section_data  = {0xEB, 0x90},
                ._section_size  = 2,
                ._section_count = 1,
        },
        ._m_tail = Frame_Config_st::Section_st {
                ._section_data  = {0xEB, 0x01},
                ._section_size  = 2,
                ._section_count = 1,
        },
        ._m_check = Frame_Config_st::Check_st {
                ._type               = Frame_Config_st::Check_st::Type_et::Check_Acc,
                ._calculate_instance = &acc32,
                ._offset             = 2,
                ._size_data          = 10,
                ._size_result        = 4,
                ._size_other         = 8,
                ._record_size_offset = 0,
                ._record_size_length = 0,
        },
        ._m_frame_length    = 18,
        ._m_fram_byte_order = Bytes_Calculator_st::ByteOrder_et::Little_Endian,
        ._m_frame_fix       = Frame_Config_st::Fix_et::UnFixed,
        ._m_return          = Frame_Config_st::Return_et::After_One,
};

static Frame_Config_st unfix_u64_sum {
        ._m_header = Frame_Config_st::Section_st {
                ._section_data  = {0xEB, 0x90},
                ._section_size  = 2,
                ._section_count = 1,
        },
        ._m_tail = Frame_Config_st::Section_st {
                ._section_data  = {0xEB, 0x01},
                ._section_size  = 2,
                ._section_count = 1,
        },
        ._m_check = Frame_Config_st::Check_st {
                ._type               = Frame_Config_st::Check_st::Type_et::Check_Acc,
                ._calculate_instance = &acc64,
                ._offset             = 2,
                ._size_data          = 10,
                ._size_result        = 8,
                ._size_other         = 12,
                ._record_size_offset = 0,
                ._record_size_length = 0,
        },
        ._m_frame_length    = 22,
        ._m_fram_byte_order = Bytes_Calculator_st::ByteOrder_et::Little_Endian,
        ._m_frame_fix       = Frame_Config_st::Fix_et::UnFixed,
        ._m_return          = Frame_Config_st::Return_et::After_One,
};

class Buffer_Tester_ct {

  public:
    Buffer_Tester_ct (const Frame_Config_st & _frame_config, std::uint8_t _frame_data[], std::uint8_t _frame_size) noexcept {
        this->_m_frame_size                      = _frame_size;
        this->_m_frame_config                    = _frame_config;
        this->_m_frame_controller.frameConfig () = this->_m_frame_config;
        std::memcpy (this->_m_frame_data, _frame_data, _frame_size);
    }

    static auto compareArrays (const std::uint8_t _array1[], const std::uint8_t _array2[], size_t _length) noexcept -> std::int32_t {
        return std::memcmp (_array1, _array2, _length);
    }

    auto test () noexcept -> bool {
        auto _round = (Buffer_Controller_ct::getBufferSize () / this->_m_frame_size + 10);

        for (unsigned i = 0; i < _round; i++)
            this->_m_frame_controller.push (this->_m_frame_data, this->_m_frame_size);

        for (unsigned i = 0; i < _round; i++)
            this->_m_frame_controller.pop ();

        for (unsigned i = 0; i < _round; i++)
            this->_m_frame_controller.push (this->_m_frame_data, this->_m_frame_size);


        if (this->_m_frame_controller.pop (this->_m_frame_recv) != this->_m_frame_size)
            if (this->_m_frame_controller.pop (this->_m_frame_recv) != this->_m_frame_size)
                return false;

        if (Buffer_Tester_ct::compareArrays (this->_m_frame_data, this->_m_frame_recv, this->_m_frame_size) != 0)
            return false;

        for (unsigned i = 0; i < _round; i++) this->_m_frame_controller.pop ();

        for (unsigned i = 0; i < _round; i++) {
            this->_m_frame_controller.push (this->_m_frame_data, this->_m_frame_size);
            if (this->_m_frame_controller.pop (this->_m_frame_recv) != this->_m_frame_size)
                return false;
            if (Buffer_Tester_ct::compareArrays (this->_m_frame_data, this->_m_frame_recv, this->_m_frame_size) != 0)
                return false;
        }

        return true;
    }

  private:
    std::uint8_t         _m_frame_recv[100] = {};
    std::uint8_t         _m_frame_data[100] = {};
    std::uint8_t         _m_frame_size      = {};
    Frame_Config_st      _m_frame_config    = {};
    Buffer_Controller_ct _m_frame_controller;
};

int main (const int _argc, const char * const _argv[], const char * const _envp[]) {

    Buffer_Tester_ct buffer_fixed_u8_sum {fix_u8_sum, array_fixed_u8_sum, 13};
    Buffer_Tester_ct buffer_fixed_u8_crc {fix_u8_crc, array_fixed_u8_crc, 13};
    Buffer_Tester_ct buffer_fixed_u16_sum {fix_u16_sum, array_fixed_u16_sum, 14};
    Buffer_Tester_ct buffer_fixed_u16_crc {fix_u16_crc, array_fixed_u16_crc, 14};
    Buffer_Tester_ct buffer_fixed_u32_sum {fix_u32_sum, array_fixed_u32_sum, 16};
    Buffer_Tester_ct buffer_fixed_u32_crc {fix_u32_crc, array_fixed_u32_crc, 16};
    Buffer_Tester_ct buffer_fixed_u64_sum {fix_u64_sum, array_fixed_u64_sum, 20};
    Buffer_Tester_ct buffer_fixed_u64_crc {fix_u64_crc, array_fixed_u64_crc, 20};
    Buffer_Tester_ct buffer_unfix_u8_sum {unfix_u8_sum, array_unfix_u8_sum, 15};
    Buffer_Tester_ct buffer_unfix_u8_crc {unfix_u8_crc, array_unfix_u8_crc, 15};
    Buffer_Tester_ct buffer_unfix_u16_sum {unfix_u16_sum, array_unfix_u16_sum, 16};
    Buffer_Tester_ct buffer_unfix_u16_crc {unfix_u16_crc, array_unfix_u16_crc, 16};
    Buffer_Tester_ct buffer_unfix_u32_sum {unfix_u32_sum, array_unfix_u32_sum, 18};
    Buffer_Tester_ct buffer_unfix_u32_crc {unfix_u32_crc, array_unfix_u32_crc, 18};
    Buffer_Tester_ct buffer_unfix_u64_sum {unfix_u64_sum, array_unfix_u64_sum, 22};
    Buffer_Tester_ct buffer_unfix_u64_crc {unfix_u64_crc, array_unfix_u64_crc, 22};

    if (buffer_fixed_u8_sum.test () == false) return false;
    if (buffer_fixed_u8_crc.test () == false) return false;
    if (buffer_fixed_u16_sum.test () == false) return false;
    if (buffer_fixed_u16_crc.test () == false) return false;
    if (buffer_fixed_u32_sum.test () == false) return false;
    if (buffer_fixed_u32_crc.test () == false) return false;
    if (buffer_fixed_u64_sum.test () == false) return false;
    if (buffer_fixed_u64_crc.test () == false) return false;
    if (buffer_unfix_u8_sum.test () == false) return false;
    if (buffer_unfix_u8_crc.test () == false) return false;
    if (buffer_unfix_u16_sum.test () == false) return false;
    if (buffer_unfix_u16_crc.test () == false) return false;
    if (buffer_unfix_u32_sum.test () == false) return false;
    if (buffer_unfix_u32_crc.test () == false) return false;
    if (buffer_unfix_u64_sum.test () == false) return false;
    if (buffer_unfix_u64_crc.test () == false) return false;


    return 0;
}
